package com.ellricky

import android.app.Activity
import android.app.Application
import android.content.Context
import android.os.Bundle
import androidx.multidex.MultiDex
import com.ellricky.baselib.util.EAppUtil
import com.tencent.tinker.loader.app.TinkerApplication
import com.tencent.tinker.loader.shareutil.ShareConstants

class MyApp() : TinkerApplication(
    ShareConstants.TINKER_ENABLE_ALL, "com.ellricky.SampleApplicationLike",
    "com.tencent.tinker.loader.TinkerLoader", false
) {

    private lateinit var mApp: Application
    private val TAG_APP = "EllrickyApp"

    fun getApp(): Application {
        return mApp
    }


    override fun onCreate() {
        super.onCreate()
        mApp = this
        EAppUtil.initApp(this)
        registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
            override fun onActivityPaused(activity: Activity) {
            }

            override fun onActivityStarted(activity: Activity) {
            }

            override fun onActivityDestroyed(activity: Activity) {
            }

            override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
            }

            override fun onActivityStopped(activity: Activity) {
            }

            override fun onActivityResumed(activity: Activity) {
            }

            override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
//                PushAgent.getInstance(activity).onAppStart()
            }

        })
    }

    override fun attachBaseContext(base: Context?) {
        super.attachBaseContext(base)
        MultiDex.install(this)
    }


}


